<?php

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
/*echo md5('123456');
echo '</br>'.sha1(123456);
mysql_connect('localhost','root','');
mysql_select_db('textguest');
mysql_query('SET NAMES UTF8');
$_query="SELECT * FROM  tg_user WHERE tg_password=sha1(123456)";
$res=mysql_query($_query);        
while ($row=mysql_fetch_array($res)){;
        foreach ($row as $value) {
          echo '<br/>'.--$value;
}
}
mysql_close();*/

/*$a=array('3','8','1','4','11','7');
$len = count($a);
//从小到大
for($i=1;$i<$len;$i++)
{
for($j=$len-1;$j>=$i;$j--)
if($a[$j]<$a[$j-1])
{//如果是从大到小的话，只要在这里的判断改成if($b[$j]>$b[$j-1])就可以了
 $x=$a[$j];
 $a[$j]=$a[$j-1];
 $a[$j-1]=$x;
}
}
print_r($a);*/




header('Content-Type:text/html;charset:utf-8');
define('DB_HOST', 'localhost');
define('DB_USER', 'root');
define('DB_PWD', '');
define('DB_NAME', 'zhiwen');
$conn=mysql_connect(DB_HOST,DB_USER,DB_PWD)or die('数据库连接失败'.mysql_error());
mysql_select_db(DB_NAME, $conn)or die('数据库错误'.mysql_error());
mysql_query('SET NAMES UTF8')or die('字符集错误'.mysql_error());
?>
